home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk70 / magus110 / mprint.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-19  |  3KB  |  108 lines

  1. /*---------------------------- Start REXX Source ----------------------------*/
  2.  
  3. /*      MPrint.rexx            Modified:  15-APR-89
  4.  
  5.     Magus! Print Spooler
  6.            v1.10               Associated files: Magus!.rexx
  7.                                                  Magus!Cntl.rexx
  8.             by                                   Magus!Util.rexx
  9.         Dan Schenck                              MPrintIt.rexx
  10.          Tulsa, OK
  11.  
  12.       GEnie: D.SCHENCK
  13.        (918) 492-0523
  14.                          */
  15.  
  16. /*  Requires rexxarplib.library v2.1 */
  17.  
  18. signal on BREAK_C
  19. true = 1
  20. false = 0
  21. cdir = pragma('D')
  22.  
  23. parse arg name .
  24.  
  25. if ~showlist("P","MAGUSPORT") then
  26.   do
  27.     address command "arun" "rx" "rexx:MAGUS!.rexx"
  28.     do while(~showlist("P","MAGUSPORT"))
  29.       call delay(150)
  30.     end
  31.   end
  32.  
  33. call parse_dir
  34. do forever
  35.   do while(name = "df0:||||")
  36.     name = getfile(200,200,cdir,,'Select File to Print or CANCEL to EXIT')
  37.     if name = "" then call end_all()
  38.     call parse_dir
  39.   end
  40.   if index(cdir,":") = 0 then file2show = pragma('D') || cdir || "/" || name
  41.   else if right(cdir,1) ~= ":" then file2show = cdir || "/" || name
  42.        else file2show = cdir || name
  43.   prt_options = Getenv('prt_options_raw')
  44.   do while (Getenv('prnt_spooler') = 'GETTINGCLIP')
  45.     call delay(25)
  46.   end
  47.   rtn = Setenv('prnt_spooler','GETTINGCLIP')
  48.   rtn = Setenv('next_file2print',file2show||'^'||prt_options)
  49.   rtn = Setenv('prnt_spooler','NA')
  50.   address "MAGUSPORT" "PRINT "
  51.   name = "df0:||||"        
  52. end
  53.  
  54. /*                            parse_dir Procedure                           */
  55. /*                                                                          */
  56. /*  Separate the directory portion of the file name if there is any from    */
  57. /*  the file name itself.  "cdir" will contain the new directory or be left */
  58. /*  untouched if there is no directory.  "name" will be modified to only    */
  59. /*  contain the file name itself or "df0:||||" if there is no file name.    */
  60.  
  61. parse_dir: procedure expose cdir name
  62.   if length(name) = 0 then
  63.     do /*  No name or directory  */
  64.       name = "df0:||||"
  65.       return
  66.     end
  67.   if ~exists(name) then
  68.     do /*  Bad directory/file name  */
  69.       name = "df0:||||"
  70.       return
  71.     end
  72.   i_colon = lastpos(":",name)
  73.   i_slash = lastpos("/",name)
  74.   if left(statef(name),1) = "F" then
  75.     do /*  This a file, not just a directory  */
  76.       if i_slash > 0 then
  77.         do /*  At least one subdirectory has been given  */   
  78.           cdir = substr(name,1,i_slash-1)
  79.           name = substr(name,i_slash+1)
  80.           return
  81.         end
  82.       if i_colon > 0 then
  83.         do /*  A main directory has been given  */
  84.           cdir = substr(name,1,i_colon)
  85.           name = substr(name,i_colon+1)
  86.           return
  87.         end
  88.       return
  89.     end
  90.   if i_slash > 0 then
  91.     do /*  A subdirectory with no file has been given  */
  92.       cdir = name
  93.       name = "df0:||||"
  94.       return
  95.     end
  96.   /*  A main directory or subdirectory only has been given  */
  97.   if i_colon = 0 then cdir = cdir || name
  98.   else cdir = name
  99.   name = "df0:||||"
  100.   return
  101.  
  102. BREAK_C:
  103.   call end_all()
  104. end_all:
  105.   exit
  106.  
  107. /*----------------------------- End REXX Source -----------------------------*/
  108.